import request from '@/utils/request'

// DELETE /admin/product/baseTrademark/remove/{id}
// 删除BaseTrademark

// POST /admin/product/baseTrademark/save
// 新增BaseTrademark

// PUT /admin/product/baseTrademark/update
// 修改BaseTrademark

// GET /admin/product/baseTrademark/{page}/{limit}
// 分页列表

// 获取所有的品牌数据   GET     /admin/product/baseTrademark/getTrademarkList


export interface TrademarkModel {
    id?: number,// 新增保存tm的时候没有id的，只有保存过之后才有id
    tmName: string,
    logoUrl: string
}

export type TrademarkList = TrademarkModel[]

export interface TrademarkPageModel {
    current: number,
    pages: number,
    records: TrademarkList,
    searchCount: number,
    size: number,
    total: number
}

export default {
    getPage(page: number, limit: number) {
        return request.get<any, TrademarkPageModel>(`/admin/product/baseTrademark/${page}/${limit}`)
    },
    save(data: TrademarkModel) {
        return request.post<any, null>(`/admin/product/baseTrademark/save`, data);
    },
    update(data: TrademarkModel) {
        return request.put<any, null>(`/admin/product/baseTrademark/update`, data)
    },
    delete(id: number) {
        return request.delete<any, null>(`/admin/product/baseTrademark/remove/${id}`)
    },
    // 获取所有的品牌数据
    getTrademarkList() {
        return request.get<any, TrademarkModel[]>(`/admin/product/baseTrademark/getTrademarkList`)
    }
}

